<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script type="text/javascript" src="vue.js"></script>
</head>
<body>
    <div id="root">
        <school></school>
        <hello></hello>
    </div>
    <script type="text/javascript">
        Vue.config.productionTip = false
        //创建school对象
        const  school = Vue.extend({
            name:'school',
            template:`
                    <div>
                        学校名称：{{name}}
                        学校地址：{{address}}
                        <button @click="showName">点我显示学校名</button>
                    </div>    
                    `,
            data(){
                return {
                name:'尚硅谷115',
                address:'北京昌平'
                }             
            },
            methods:{
                showName(){
                    alert(this.name)
                }
            }

         })

         const hello = Vue.extend({
            template:`<h2>{{msg}}</h2>`,
            data(){
                return {
                    msg:'你好啊对啊'
                }
            }
         })
         console.log('@',school)
      const vm =  new Vue({
            el:'#root',
            components:{
                school,
                hello
            }
        })

    </script>
</body>
</html>